package com.zjx.postprocessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor;
import org.springframework.stereotype.Component;

import java.lang.reflect.Constructor;

/**
 * Description:
 * <p>
 * ClassName: MySmartInstantiationAwareBeanProcessor
 * date: 2021/3/28 20:32
 *
 * @author zzjx
 * @version 1.0
 * @since JDK 1.8
 */
@Component
public class MySmartInstantiationAwareBeanProcessor implements SmartInstantiationAwareBeanPostProcessor {
	@Override
	public Class<?> predictBeanType(Class<?> beanClass, String beanName) throws BeansException {
		//返回预测bean的类型
		return null;
	}
    //返回构造器所需要的候选列表
	@Override
	public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, String beanName) throws BeansException {
		return null;
		//返回我们指定的构造器，如果返回null默认用无参构造器
	}
    // 返回早起的bean引用 定义早期的earlyFactory bean三级缓存
	@Override
	public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException {
		System.out.println("SmartInstantiationAwareBeanPostProcessor......init");
		return null;
	}
}
